//
//  LCBaseViewController.m
//  TianXiaShi
//
//  Created by qianfeng01 on 15-7-11.
//  Copyright (c) 2015年 CongCong. All rights reserved.
//

#import "LCBaseViewController.h"

@interface LCBaseViewController ()

@end

@implementation LCBaseViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    self.manager = [AFHTTPRequestOperationManager manager];
    _manager.responseSerializer = [AFHTTPResponseSerializer serializer];
    HotArray *hot = [HotArray sharedHot];
    self.hotList = [hot getModel];
    RanklisArray *rank = [RanklisArray sharedRank];
    self.rankList = [rank getModel];
}
- (void)downWebDataWithUrl:(NSString *)url
{
    //[NSString stringWithFormat:@"%@%@%@%@",recommend1,self.channelId,recommend2,self.postionId]
    //NSLog(@"%@",url);
    [MMProgressHUD setPresentationStyle:MMProgressHUDPresentationStyleDrop];
    //[MMProgressHUD showDeterminateProgressWithTitle:@"下载。。。" status:nil];
    [MMProgressHUD showWithStatus:@"下载。。。"];
    __weak typeof(self) weakSelf = self;
    
    [self.manager GET:url parameters:nil success:^(AFHTTPRequestOperation *operation, id responseObject) {
        if (responseObject) {
            NSDictionary *dict = [NSJSONSerialization JSONObjectWithData:responseObject options:NSJSONReadingMutableContainers error:nil];
            
            [weakSelf initJosnModelWith:dict];
            [MMProgressHUD dismiss];
        }
    } failure:^(AFHTTPRequestOperation *operation, NSError *error) {
        NSLog(@"下载失败");
        [MMProgressHUD dismissWithError:@"失败了"];
    }];
    
    
}

- (void)initJosnModelWith:(NSDictionary *)dict{}
- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
